Handlebars templates and refactoring