new templating code