Made IsValid better.  Added more tests.