Rewrite validate to handle validation in both directions, and clean up
output.
Merge pull request #638 from Kinematics/4.1-dev-validate

Rewrite validate to handle validation in both directions, and clean up output.