Cleaning up the GUI code