Refactored the Gui class.