Code cleaning and fixing for bulk edits