added new code temp, to remove later to organize
added some more validation code.
added explanatory comments
adding the new validation code