updated progress bar logic