Refactor templates.