Added security precautions and data integrity checks.