Gui refactoring