flat_map instead of map then flatten