Refactor and rehash