Replace map.flatten(1) with flat_map
Merge pull request #1308 from sferik/flat_map

Replace map.flatten(1) with flat_map