Just changing some #map().flatten calls to #flat_map, which is more efficient.