routing: refactor the view handlers