completed the validation code