refactoring home controller