Controller refactored