Emperor Wen of Sui, personal name Yang Jian, a native of Huayin in Hongnong, was the founding emperor of the Sui dynasty. He rose in the merit-nobility of the late Northern dynasties state of Northern Zhou, inheriting the title Duke of Sui; his daughter was empress to Emperor Xuan of Zhou. When Xuan died in 580 and the child Emperor Jing succeeded, Yang Jian entered court as regent through his consort-clan connection, crushed the revolts of Yuchi Jiong and others, and took control of government. In 581 he accepted the abdication and declared the Sui, capital at Daxing city. In 589 his armies crossed the Yangtze and destroyed Chen of the Southern dynasties, ending nearly three hundred years of division since the fall of the Western Jin and reuniting China. His reign rebuilt the institutions of empire: at court he fixed the Three Departments and Six Ministries system, revised the Kaihuang code, simplified local administration to prefectures and counties, pressed on with the equal-field system and household registration, and ordered the provinces to recommend men chosen by written examination in several subjects — the germ of the examination system. Personally industrious and frugal by nature, he governed with clarity and filled the granaries — the 'Kaihuang peace'. In age he grew suspicious, displacing his eldest son Yang Yong for Yang Guang as heir. He died in 604; the Tang dynasty inherited his institutions whole, and the Three Departments system and the examinations shaped Chinese government for the next thousand years.