Refactor around decryption and html generation.