Refactor homepage view to use a template