To avoid having to walk across the Square to the mosque, Shah Abbas had the architect build a tunnel spanning the piazza from the Ali Qapu Palace to the mosque. On reaching the entrance of the mosque, one would have to walk through a passage that winds round and round, until one finally reached the main building. Along this passage there were standing guards, and the obvious purpose of this design was to shield the women of the harem as much as possible from anyone’s entering the building. At the main entrance there were also standing guards, and the doors of the building were kept closed at all times.