Cleaned up Gui code