minor:  some error handling and minor changes to the schema.