Optimization of  ProgressThread