Refactor homepage controller