Merge of new validator with tests

Per @gvwilson request (issue #34).
This file is quite long - put the helper classes in a utility .py file?