General code cleanup data integrity check improved