Leave the schema-id untouched; fix
Move function to inner-scope
Fixed keys, parts and segments