Refactor progressbar