The Khmer empire was founded upon extensive networks of agricultural rice farming communities. A distinct settlement hierarchy is present in the region. Small villages were clustered around regional centres, such as the one at Phimai, which in turn sent their goods to large cities like Angkor in return for other goods, such as pottery and foreign trade items from China. The king and his officials were in charge of irrigation management and water distribution, which consisted of an intricate series of hydraulics infrastructure, such as canals, moats, and massive reservoirs called "barays". Society was arranged in a hierarchy reflecting the Hindu caste system, where the commoners – rice farmers and fishermen – formed the large majority of the population. The kshatriyas – royalty, nobles, warlords, soldiers, and warriors – formed a governing elite and authorities. Other social classes included brahmins (priests), traders, artisans such as carpenters and stonemasons, potters, metalworkers, goldsmiths, and textile weavers, while on the lowest social level were slaves.