refactored code to have home page use a template