The barangay was the basic political and economic unit in pre-colonial Philippines, headed by a datu or rajah. Society consisted of a petty nobility class that owned land, the maharlika or freemen class, timawa serf class, and alipin slave class. Higher political development occurred in the Islamic sultanates of Sulu and Mindanao, which had a feudal social structure under the supreme rule of sultans over datus. By the time of Spanish colonization, the people had developed agriculture, infrastructure, trade, and crafts.