refactor schemas and routes