Following the attempted Jacobite invasion of 1708, improvements to the castle's defences were ordered as a matter of priority. A scheme of new defences was proposed by Theodore Dury, although this was criticised by one Captain Obryan, who put forward his own, much more expensive, scheme. In the end a compromise was built, and was complete by 1714. The main front wall was extended outwards, to form Guardhouse Square. This had the effect of creating two defensive walls, both of which were fronted by ditches defended by covered firing galleries known as caponiers. One of the caponiers survives and is accessible from Guardhouse Square by a narrow staircase.