refactored to support yamlregistry object.