Ramathibodi tried to unify his kingdom. In 1360 he declared Theravada Buddhism the official religion of Ayutthaya and brought members of a sangha, a Buddhist monastic community, from Ceylon to establish new religious orders and spread the faith among his subjects. He also compiled a legal code, based on the Indian Dharmashastra (a Hindu legal text) and Thai custom, which became the basis of royal legislation. Composed in Pali -- an Indo-Aryan language closely related to Sanskrit and the language of the Theravada Buddhist scriptures -- it had the force of divine injunction. Supplemented by royal decrees, Ramathibodi's legal code remained generally in force until the late nineteenth century.