Geodesic: loop in a different order to shave a few seconds more