core data attempt 2 -- various bug fixes