adding doParallel version of the loop.