Added support for custom templates