Changing looping structure to enable progress bar.