Tidy up hashtable implementation and clients of it.