changes to showPreferences() method, refactoring