Move action execution code to main window