refactor example for progressbar