adding layout handling directly to the handlebars engine and to the middleware