Merge of new validator with tests

Per @gvwilson request (issue #34).
A comment this long wants to be in the docstring.