Smarter templating