I tried to edit this answer. When the preview looked OK, I saved the edit, but the actual outcome was a mess. I tried various workarounds, but each time the result, despite a good preview, was worse or introduced a new error. Finally, I tried to cancel all my edits and roll back to the OP's version, but (not really understanding how to do this) only created a labyrinth of newly numbered edits.
Luckily the final result is somewhat an improvement on the original, but it is only half way to being what I wanted. I dare not attempt a further edit for fear of making it worse again.