If I understand correctly, this is the crux of the fix, along with the `foreach saveDivergent` above. I assume this is your plan, but it would be ideal structure the PR into pure refactoring + this two-line fix.

lookin' good!