minor templating refactoring