Refactored changes for shared preferences.