Japan was ruled by clans, the clans were groups based on family ties. Each clan worshiped "kami", nature spirits, whom they believed were their ancestors. A religion formed from this belief called Shinto, meaning "way of the kami." The emperor of the Yamato Clan claimed to be the descendant of the sun goddess, Amaterasu. The Yamato Clan had controlled much of the island Honshu, and Yamato chiefs called themselves the emperors of Japan. Other clans took over the Yamato Clan yet didn't remove the emperor, the emperor acted as a figurehead until the 1900's. Japan had been greatly influenced by China and Korea. At first Japan didn't have a written form of writing, however, they learned Chinese writing from Korean traders. Japan was introduced to Buddhism by China, which quickly spread throughout Japan. Japan's government and law code were also influenced by the Chinese. After the Tang fell Japan stopped sending missions to China. In 794 Japan's capital was moved to Heian, what is now Kyoto, after this many nobles moved there as well; this was called the Heian Period. Nobles lived in luxury, they had large palaces and spent most of the day observing art or reading poetry. During this time period a Japanese written language was developed by combining Chinese and phonetic characters.