Added schema validation and fixed validation errors