improved handlebars impementation