Reworked to use Core Data