Added support for template inheritance.