change cursor to Wait whenever progress bar is not used
refactor code to remove unused vars