refactored CoreData