government had become very corrupt and inefficient, with much of the state's treasury used primarily to pay for the royal entourage. Many officials had no meaningful task except taking money and Chu's army, while large, was of low quality. In the late 390s BCE, King Dao of Chu made Wu Qi his chancellor. Wu's reforms began to transform Chu into an efficient and powerful state in 389 BCE, as he lowered the salaries of officials and removed useless officials. He also enacted building codes to make the capital Ying seem less barbaric. Despite Wu Qi's unpopularity among Chu's ruling class, his reforms strengthened the king and left the state very powerful until the late 4th century BCE, when Zhao and Qin were ascendant. Chu's powerful army once again became successful, defeating the states of Wei and Yue. Yue was partitioned between Chu and Qi in either 334 or 333 BCE. However, the officials of Chu wasted no time in their revenge and Wu Qi was assassinated at King Dao's funeral in 381 BCE. Prior to Wu's service in the state of Chu, Wu lived in the state of Wei, where his military analysis of the six opposing states was recorded in his magnum opus, The Book of Master Wu. Of Chu, he said: During the late Warring States period, Chu was increasingly pressured by Qin to its west, especially after Qin enacted and preserved the Legalistic reforms of Shang Yang. In 241 BCE, five of the seven major warring states–Chu, Zhao, Wei, Yan and Han–formed an alliance to fight the rising power of Qin. King Kaolie of Chu was named the leader of the alliance and Lord Chunshen the military commander. According to historian Yang Kuan, the Zhao general Pang Nuan () was the actual commander in the battle. The allies attacked Qin at the strategic Hangu Pass but were defeated. King Kaolie blamed Lord Chunshen for the loss and began to mistrust him. Afterwards, Chu moved its capital east to Shouchun, farther away from the threat of Qin. As Qin expanded into Chu's territory, Chu was forced to expand southwards and eastwards, absorbing local cultural influences along the way. Lu was conquered by King Kaolie in 223 BCE. By the late 4th century BCE, however, Chu's prominent status had fallen into decay. As a result of several invasions headed by Zhao and Qin, Chu was eventually completely wiped out