Move progress bar code so that tic/toc works