switch from multiprocessing apply_async to custom pool code