refactor templates to use a base template