Mostly improved templating