Make pool.map function top-level