refactor schema constructor