Making initial changes to the logic to be able to perform castle.