My changes might break things...sorry :(
added replace nonce functionality