Refactor templates/views