finished core data implementation