refactor core data