Refactor base.html template