Generalize hash table code in prep for small hash table
1.0dev.19: merge hash table prepared to get small with Jeremy's changes