Move to flat_map now that we don't use 1.8