Added code for nonce validation.