File association, improvements, logic moved from MainWindow to State