Refactoring controller structure