Moved the ActionListener to its own class for readability and better reuse of code. Also created methods for loading and saving preferences. This needs to be actually created.