refactored unitmanager