refactoring in gui