Refactors routes and schemas