Added max_time option to UpgradeBuildings implemented #2.