Wait for key input instead of sleeping