Introduce dependency injection in the home controller and fix some problems