to the gardens. Some remains of the 12th-century gatehouse can still be seen, in particular the archway attached to the side of the lodge. The lodge is built of stone, and does not contain timber framing like the nearby Hospitium. The lodge, along with the attached railings, gates and gate piers are all Grade I listed buildings, which means that they are of outstanding interest. Originally, the lodge may have been used as a guesthouse for the abbey, and was the point where the poor could claim alms from the abbey. After the abbey's dissolution, the lodge became a courthouse until 1722, when part of the building became the Brown Cow pub. In 1840 John Philips, the Yorkshire Museum's curator, restored and converted it to use as his home while retaining its external appearance. The lodge subsequently became used as offices, and during the early 21st century became the headquarters of the York Museums Trust. Along with the lodge, some of the abbey's precinct walls are still standing. A section of the remaining walls runs along the north-west part of the gardens and extends further along Marygate to Bootham. The walls were constructed in 1266 and increased in height and crenellated in 1318 under a royal licence from Edward III. Originally there was a defensive ditch along the outside of the walls. The walls include several towers, not all of them dating from the medieval period; the semicircular tower near the gatehouse is a 19th-century reconstruction. The walls and towers were used for the abbey's defence, e.g. in disputes with the City of York over land ownership and taxes, and played a role in the defence of the city during the siege of York. The Hospitium is located between the ruins of St Mary's Abbey Church and the River Ouse, and is thought to have originally been a guest house for visitors to the abbey of low social rank, or possibly a barn. It was originally part of a group of buildings in the abbey grounds that included a brew-house, stables, mill and, near the main gate, a boarding school with 50 pupils. The oldest parts of the ground floor were built around 1300, but the upper storey has been extensively restored in modern times. The ruined gateway at the side dates back to the 15th century, and was probably the entrance to a passage that ran towards the water-gate