solved flat_map