Use each_slice and flat_map