refactoring templates