section_path: History/Rebuilding and recovery
section_name: Rebuilding and recovery
paragraph_text: Rebuilding and recovery
  
  Although these natural calamities and rebellions stained the reputation and hampered the effectiveness of the central government, the early 9th century is nonetheless viewed as a period of recovery for the Tang dynasty. The government's withdrawal from its role in managing the economy had the unintended effect of stimulating trade, as more markets with fewer bureaucratic restrictions were opened up. By 780, the old grain tax and labor service of the 7th century was replaced by a semiannual tax paid in cash, signifying the shift to a money economy boosted by the merchant class. Cities in the Jiangnan region to the south, such as Yangzhou, Suzhou, and Hangzhou prospered the most economically during the late Tang period. The government monopoly on the production of salt, weakened after the An Lushan Rebellion, was placed under the Salt Commission, which became one of the most powerful state agencies, run by capable ministers chosen as specialists. The commission began the practice of selling merchants the rights to buy monopoly salt, which they would then transport and sell in local markets. In 799 salt accounted for over half of the government's revenues. S.A.M. Adshead writes that this salt tax represents "the first time that an indirect tax, rather than tribute, levies on land or people, or profit from state enterprises such as mines, had been the primary resource of a major state." Even after the power of the central government was in decline after the mid 8th century, it was still able to function and give out imperial orders on a massive scale. The Old Book of Tang, compiled in 945, recorded a government decree issued in 828 that standardized irrigational square-pallet chain pumps throughout the country.
  
  In the second year of the Taihe reign period, in the second month... a standard model of the chain pump was issued from the palace, and the people of Jingzhao Fu (d footnote: the capital) were ordered by the emperor to make a considerable number of machines, for distribution to the people along the Zheng Bai Canal, for irrigation purposes.|
  
  The last great ambitious ruler of the Tang dynasty was Emperor Xianzong (r. 805–820), whose reign was aided by the fiscal reforms of the 780s, including a government monopoly on the salt industry. He also had an effective and well-trained imperial army stationed at the capital led by his court eunuchs; this was the Army of Divine Strategy, numbering 240,000 in strength as recorded in 798. Between the years 806 and 819, Emperor Xianzong conducted seven major military campaigns to quell the rebellious provinces that had claimed autonomy from central authority, managing to subdue all but two of them. Under his reign there was a brief end to the hereditary jiedushi, as Xianzong appointed his own military officers and staffed the regional bureaucracies once again with civil officials. However, Xianzong's successors proved less capable and more interested in the leisure of hunting, feasting, and playing outdoor sports, allowing eunuchs to amass more power as drafted scholar-officials caused strife in the bureaucracy with factional parties. The eunuchs' power became unchallenged after Emperor Wenzong 's (r. 826–840) failed plot to have them overthrown; instead the allies of Emperor Wenzong were publicly executed in the West Market of Chang'an, by the eunuchs' command.
  
  However, the Tang did manage to restore at least indirect control over former Tang territories as far west as the Hexi Corridor and Dunhuang in Gansu. In 848 the ethnic Han Chinese general Zhang Yichao (799–872) managed to wrestle control of the region from the Tibetan Empire during its civil war. Shortly afterwards Emperor Xuānzong of Tang (r. 846–859) acknowledged Zhang as the protector (防禦使; fángyùshǐ) of Sha Prefecture, and military governor of the new Guiyi Circuit.
  
  The Tang dynasty recovered its power decades after the An Lushan rebellion and was still able to launch offensive conquests and campaigns like its destruction of the Uyghur Khaganate in Mongolia in 840–847.