SchemaProvider refactor and tests