A bit of template refactoring