Major refactoring to UpgradeBuildings.