Code clean up. Showing a progress bar while connecting.