Refactored code to make more sense when building Defense buildings.