Controller refactoring