refactoring progressbar