More WIP: Further work on templates for the UI and a routing code bugfix