progress bar logic worked out and functioning