small refactoring of templates