added encryption and decryption functions