Schema validation

Simple version - doesn't do much error handling, but does work.