Its sale in the late 17th century to the Earls of Hopetoun, was to see much structural alteration to the building. The Hopes were originally an Edinburgh family with strong links to the law. During the Williamite Revolution the Keiths were attainted as Jacobites. The Earl Marischal was coerced into the redistribution of his properties, Keith Marischal included. The Hope family were engaged in wholesale acquisition of the property of Jacobite sympathisers and eventually managed to amass massive estates in the Lothians over the course of the 18th century. It is they who carried out the quasi-symmetrical extension to the west of the house to construct a new wing, forming a courtyard house. The east wing being the original tower. The walled garden was added in 1807.