Refactor templates to use base template