add validation code