refactoring gui