refactor view controller to home controller