Further work with coredata
Refactoring to reduce code volue
Implemented editing of intervals. Refactored a bit for clarity