some work on kvstore, etc
copied over from node-client