internal cleanups and reworked the preview decryption