Xuanzang reached Kashgar in what is now the westernmost part of China and Hetien, the capital of the Buddhist kingdom of Khotan. The King of Khotan came out to greet him, and he spent seven or eight months there lecturing on what he had learned during his pilgrimage. He finally arrived back in Sian in the spring of 645. Xuanzang arrived back in China with 150 Buddhist relics, six statues and more than 650 religious texts after a journey of 40,000 miles. The Emperor ordered him to write about his experiences. He had completed this book, Ta-T'ang Si-Yu-Ki (Memoirs on Western Countries) by the time he died in 649.