Add proper handling of nonces