This done in a convoluted way. Why not simply add all the futures in the loop, and then do Future.wait() outside the loop?