I pushed a commit that swaps the first two for loops.