Adding progress bar assignment and clean up code