added conditional templateName