Added main thread pause to get result from the window