Granada, Spain). Al-Mansur also built a new room for the library on the south side of the mosque (around the library's current location), which was connected to the mosque via a door in the qibla wall. The Alaouite dynasty, which has ruled Morocco from the 17th century onward, continued to perform minor additions and regular maintenance on the mosque. A ribbed cupola in the central nave, where the 1337 Marinid chandelier hangs, has been dated by Terrasse to the Alaouite period, although Xavier Salmon has more recently argued that at least some elements of the dome seem to date from the Marinid era. The stucco decoration of the central archway at the courtyard entrance to the prayer hall (i.e. the arch inside which the Marinid-era anaza stands) also dates from the Alaouite period; an inscription at the top of the arch gives the year 1864–1865 (1281 AH). The present library building dates mainly from a major expansion and modification in the 20th century, particularly in the 1940s. The new library expansion, which included a large new reading room, was inaugurated in 1949. Current structure Exterior Al-Qarawiyyin's exterior does not generally present a monumental appearance and is integrated with the dense urban fabric around it. By one count there are 18 separate gates and entrances distributed around its perimeter. The gates vary from small rectangular doorways to enormous horseshoe arches with huge doors preceded by wooden roofs covering the street in front of them. While the doors are generally made of wood, some of the gates have extensive ornate bronze overlays crafted during the Almoravid period. The most ornate and best-preserved examples include the doors of the principal northern gate, Bab al-Ward (which opens onto the courtyard), the western gate called Bab Sbitriyyin, and the southwestern gate Bab al-Gna'iz, which leads to the Jama' al-Gna'iz. While the doors of Bab al-Ward preserve original pieces and were restored in 2005–2007, the doors of Bab al-Gna'iz and Bab Sbitriyyin are replicas made in the 1950s that replaced the originals, whose fragments are kept by the Dar Batha Museum. The northwestern gates of the mosque, Bab al-Shama'in (or Bab Chemaine) and Bab al-Maqsura, also have heavy bronze fittings, including some ornate knockers that date from the Almoravid period. Adjacent to Bab al-Ward on its west side is another doorway, Bab al-Hafa ("Gate of the Barefooted"). It is from the Almohad era, which is distinguished