pid validation code