Added url encoding for templateName