Refactor home page view to use as a template