mild refactoring for hash tables