refactor schema