refactor templates to use base.html template