Updated calculation of progress bar