Updated to Use Preferences to store data.