cleaned up validation code

and did n=2 testing