Handle the key in the main thread