Refactoring Preferences class