Moved creation of routes to before rendering view