Refactor home-controller.js