Improved templating