wrote nonce code