Added support for handling multiple templates with same name