Added support for templates