updated the validation code