refactored from Thread data parallelism to Parallel.For