Repair logic