Refactored with a GUI event queue