Working version of encryption & decryption