Slight reorganization for speed:  separated hashes and kv storage;  switched to storing direct kvtypes instead of pointers for strings.