working on, this has many bugs. will remove core-data.