changed encrypt and decrypt code