refactoring in progressbar