moved nonce to module level