Added support for inner templates