Added initial support for templates.