Externalize the progress bar reducing if statement
if to switch