kv store example code minor refactoring