Added encrypt and decrypt functions