The outermost wall around the fourth courtyard has four simple, insignificant gateways. The walls and gateways of the fourth courtyard were added in the 16th century by Vijayanagara rulers after they had defeated the Madurai Sultanate, and this outermost layer was heavily fortified by the Nayakas in the 17th century. These face the four large gopurams that are gateways into the third courtyard. These gopurams are also landmarks from afar. Inside the third courtyard, near the northern gopuram, is the Shivaganga tank, the thousand pillar mandapam, the Subrahmanyar (Murugan, Kartikeya) shrine and the shrine for Parvati (as Shivakama Sundari). The other three gateways are closer to the sanctum. The four gopurams pilgrims and visitors to enter the temple from all four cardinal directions. The complex is interconnected through a maze of pathways.