changed the validation code