Clean out some dead vars.
Clean up the GUI state handling.

Much cleaner control of when the GUI is visible and which context menu
buttons are available.