Functions cleanup and nonce authorization added in