refactoring main GUI application to