added decryption function & flowchart