rearrange a bit of validation code.  it essentially all needs rewritten
for clarity and brevity