hashtables: cleanup duplicate code.