[WIP] New schema API. Not fully tested.