refactored homecontroller for testing