follow-up solidification of the new regime. Even being a newcomer, Li Yan was invited to constitute the Shu Ke (蜀科; the code of law for the Shu region) with Zhuge Liang, Fa Zheng, Yi Ji and Liu Ba. (The Shu Ke was the most important guidance on the legal system of the Shu Han state later.) Li Yan continued to prove his talent as a commandery administrator — several major civil projects were initiated and conducted under his leadership: a tunnel was dug through Mount Tianshe, roads along rivers were repaired, infrastructures within his jurisdiction were decorated and rebuilt. Residents under Li Yan's rule were pleased. However, he started to reveal his weak intra-bureaucratic relationship with his peer. Yang Hong, Li Yan's official chief assistant, opposed one of Li Yan's reconstruction projects — the relocation of the Administrator's residency. Li Yan refused to listen to Yang Hong's suggestion; Yang Hong resigned after repeatedly objecting to Li Yan's plan. Wang Chong, a General of Standard under Li Yan, purportedly defected to Wei after a major fall-out with his supervisor. In 218, while Liu Bei was wrestling control with Cao Cao over Hanzhong Commandery, the bandit leaders Ma Qin (馬秦) and Gao Sheng (高勝) rebelled. The rebels controlled Zizhong County and gathered several tens of thousands people to join their cause. Since the majority of the mobile forces were deadlocked in the Hanzhong frontline, Li Yan could only muster 5,000-strong local defensive forces in Qianwei Commandery, where he successfully suppressed the revolt and brought back stability and order to the province and his people. Gao Ding, the leader of the Sou (叟) tribe, also took this opportunity to attack Xindao County (新道縣), but Li Yan deftly led his unit to defend the county and repelled Gaoding's aggression. For his effort, Li Yan was promoted to General Who Assists Han (輔漢將軍). In 222, Liu Bei suffered a devastating defeat to the eastern warlord, Sun Quan, at the Battle of Xiaoting and died not long later in Baidicheng. During this year, he summoned Li Yan to Baidicheng and promoted him to the rank of Prefect of the Masters of Writing (尚書令). On his death bed, Liu Bei specifically asked Li Yan to be a co-regent with Zhuge Liang to take care of his son, Liu Shan, and appointed Li Yan as Central Protector-General (中都護) to handle all military matters — both imperial guards and