Separate GUI and console code. Run GUI on EDT.