Refactor to separate views
Add templates