Added event loop and pre-quit; now quits proper.