Refactored coreData manager. Changed tests.