Refactoring of routes and handling of errors.