Refactor web templates and routes