Major gui refactoring