Fixed issue #79 and added logic to store nonce and check subsequently to detect replays