Move logic from main window to individual classes