refactor multiprocessing