Add Core Data to project and fix some problems.