Cleaned up the GUI code a bunch.