added encrypt and decrypt methods