used async.forEach instead of async.forEachSeries to avoid the problem exceeding maximum call stack size