Outside this system to some extent were the Buddhist monkhood, or sangha, which all classes of Siamese men could join, and the Chinese. Buddhist monasteries (wats) became the centres of Siamese education and culture, while during this period the Chinese first began to settle in Siam, and soon began to establish control over the country's economic life: another long-standing social problem. The Chinese were not obliged to register for corvee duty, so they were free to move about the kingdom at will and engage in commerce. By the sixteenth century, the Chinese controlled Ayutthaya's internal trade and had found important places in the civil and military service. Most of these men took Thai wives because few women left China to accompany the men.
Ramathibodi I was responsible for the compilation of the Dharmashastra, a legal code based on Hindu sources and traditional Thai custom. The Dharmashastra remained a tool of Thai law until late in the 19th century. A bureaucracy based on a hierarchy of ranked and titled officials was introduced, and society was organised in a manner reminiscient of, though not as strict as, the Indian caste system.