refactoring: More logic moved from GUI to background code