Changing parallelism scheme

Changing the parallelism from foreach-skip-based to for-indexed-based approach.
Yes. I think it is an out-of-date version. I do not have a GitHub on my remote machine so I had to edit this code  online by changing the code on my machine and copy-paste the changes here. I did not pay attention to details within the code. I should have copied the most recent version to my machine and edit it there. Sorry about that!