Added nonce and json + many other changes