added some more validation code.
added explanatory comments
adding the new validation code