Optimized merge algorithm in dc recovery.