refactoring homecontroller