In the Kathmandu valley, the Mallas, who make several appearances in Nepalese history since ancient times, had established themselves in Kathmandu and Patan by the middle of the 14th century. The Mallas ruled the valley first under the suzerainty of Tirhut but established independent reign by late 14th century as Tirhut went into decline. In the late 14th century, Jayasthiti Malla introduced widespread socio-economic reforms, principal of which was the caste system. By dividing the indigenous non-Aryan Buddhist population into castes modelled after the four Varna system of Hinduism, he provided an influential model for the Sanskritization and Hinduization of the indigenous non-Hindu tribal populations in all principalities throughout Nepal. By the middle of the 15th century, Kathmandu had become a powerful empire which, according to Kirkpatrick, extended from Digarchi or Sigatse in Tibet to Tirhut and Gaya in India. In the late 15th century, Malla princes divided their kingdom in four – Kathmandu, Patan and Bhaktapur in the valley and Banepa to the east. The competition for prestige among these brotherly kingdoms saw the flourishing of art and architecture in central Nepal, and the building of famous Kathmandu, Patan and Bhaktapur Durbar Squares; their division and mistrust led to their fall in the late 18th century, and ultimately, the unification of Nepal into a modern state.