Replace collect.flatten with collect_concat