Added synchronize to ensure that data is saved in NSUserDefaults.