The gatehouse providing entry from the outer defences to the castle proper was erected by King James IV, and was probably completed around 1506. The entrance was via a central passage, flanked by two separate pedestrian passages. This triple arrangement was unusual in its time.