education to gain a higher position in their home towns, and the madrasas provided them with basic necessities such as lodging and bread. However, the madrasas were also teaching institutions in their own right and offered their own courses, with some Islamic scholars making their reputation by teaching at certain madrasas. Madrasas were generally centered around a main courtyard with a central fountain, off which other rooms could be accessed. Student living quarters were typically distributed on an upper floor around the courtyard. Many madrasas also included a prayer hall with a mihrab, though only the Bou Inania Madrasa of Fes officially functioned as a full mosque and featured its own minaret. In the Marinid era, madrasas also evolved to be lavishly decorated. Mausoleums and zawiyas Most Muslim graves are traditionally simple and unadorned, but in North Africa the graves of important figures were often covered in a domed structure (or a cupola of often pyramidal shape) called a qubba (also spelled koubba). This was especially characteristic for the tombs of "saints" such as walis and marabouts: individuals who came to be venerated for their strong piety, reputed miracles, or other mystical attributes. Many of these existed within the wider category of Islamic mysticism known as Sufism. Some of these tombs became the focus of entire religious complexes built around them, known as a zawiya (also spelled zaouia; ). They typically included a mosque, school, and other charitable facilities. Such religious establishments were major centers of Moroccan Sufism and grew in power and influence over the centuries, often associated with specific Sufi Brotherhoods or schools of thought. The Saadian dynasty, for example, began as a military force associated with the zawiya and followers of Muhammad al-Jazuli, a major 15th-century Sufi scholar. The Alaouites after them also sponsored many zawiyas across the country. Some of the most important examples of zawiyas in Morocco include the Zawiya of Moulay Idris I near Meknes, the Zawiya of his son Moulay Idris II in Fes, and the tombs of the Seven Saints in Marrakesh. Civic architecture Funduqs A funduq (also spelled foundouk or fondouk; ) was a caravanserai or commercial building which served as both an inn for merchants and a warehouse for their goods and merchandise. In Morocco some funduqs also housed the workshops of local artisans. As a result of this function, they also became centers for other commercial activities such as