Refactoring multiprocessing handling.