numerous changes to use leveldb and protobuf