Added a rehash() implementation and made references stable across inserts/erases.