refactoring base template