Parallelized the algorithm.