AC-4: Code review rework. Added database key encryption.