ritual with that in the capital. This was done according to a code of law called the Jingiryō, itself modelled on the Chinese Book of Rites. The Jingikan was located in the palace precincts and maintained a register of shrines and priests. An annual calendar of state rites were introduced to help unify Japan through worship. These legally mandated rites were outlined in the Yōrō Code of 718, and expanded in the Jogan Gishiki of circa 872 and the Engi Shiki of 927. Under the Jingikan, some shrines were designated as ("official shrines") and given specific privileges and responsibilities. Hardacre saw the Jingikan as "the institutional origin of Shinto". In the early 8th century, the Emperor Tenmu commissioned a compilation of the legends and genealogies of Japan's clans, resulting in the completion of the Kojiki in 712. Designed to legitimate the ruling dynasty, this text created a fixed version of various stories previously circulating in oral tradition. The Kojiki omits any reference to Buddhism, in part because it sought to ignore foreign influences and emphasise a narrative stressing indigenous elements of Japanese culture. Several years later, the Nihon shoki was written. Unlike the Kojiki, this made various references to Buddhism, and was aimed at a foreign audience. Both of these texts sought to establish the imperial clan's descent from the sun Amaterasu, although there were many differences in the cosmogonic narrative they provided. Quickly, the Nihon shoki eclipsed the Kojiki in terms of its influence. Other texts written at this time also drew on oral traditions regarding the . The Sendari kuji hongi for example was probably composed by the Mononobe clan while the Kogoshui was probably put together for the Imbe clan, and in both cases they were designed to highlight the divine origins of these respective lineages. A government order in 713 called on each region to produce fudoki, records of local geography, products, and stories, with the latter revealing more traditions about the which were present at this time. From the 8th century, worship and Buddhism were thoroughly intertwined in Japanese society. While the emperor and court performed Buddhist rites, they also performed others to honor the . Tenmu for example appointed a virginal imperial princess to serve as the , a form of priestess, at the Ise Shrine on his behalf, a tradition continued by subsequent emperors. From the 8th century onward up until the Meiji