refactoring controllers