Changed main thread wait logic