This is done now. (I also tried flat_map for this nested loop, but, as you said it would, this didn't compile because of a lifetime error)