refactored using handlebars