Refactoring classes and GUI