Refactored unit control