refactored based off of home template