refactored control