finished integration between datastore and collector. TODO: history records overwrite each other, needs to be fixed