Added support for external templates