Refactor templates
Add dialog