refactoring from DocStore to KeyValueStore