Fix event ordering

The most distant events should happen first, and the nearer ones later.

Also short-circuit the above/below logic if nothing relevant has
changed.