validating code