Koryŏ needed a secure political structure to govern effectively. It borrowed Tang and Song political models, adapting them selectively to meet Koryŏ's unique needs. Although many of the names of the Koryŏ administrative organs were the same as those used in China, in operation they often differed. Koryŏ viewed itself as an independent state distinct from China. In geographic size and population it was much smaller than China and had to respond to a different set of internal and external conditions. During the reign of King Sŏngjong (981–997) the general contours of the Koryŏ political structure took shape and were further refined with the passing of time.