Cleaned up the GUI code