window gui refactoring