replace eachSeries with map