refactor schema iteration