gui + refactoring