new, adapted, iterative merge script, works for both insertions and deletions