added schema and schema validator and modified the code