Core data schema updates and a small amount of refactoring.

Change-Id: Iafead012c593e334cdb0c784e76db8fdecfe0d84