Updated the validation code