Finished Writing validation code