Validity testing code implemented.