refactored data parallelism using Tasks to Parallel.ForEach