refactor the progress callback