 In 916 , at what would have been the end of his third term as Khitan Grand Khan , Abaoji made a number of changes moving the Khitan state closer to the model of governance used by the Chinese dynasties . He assumed the title of Celestial Emperor and designated an era name , named his oldest son Yelü Bei as his successor , and commissioned the construction of a Confucian temple . Two years later he established a capital city , Shangjing ( <unk> ) , which imitated the model of a Chinese capital city . 
