progress bar

-reduced the code generating the progress bar
-changed from if/else to to for loop