small refactor to template name handling