Move decryption into its own function.