Modification in the multiprocessing function. The previous code is still there for comparison.