Refactor Gui