Simplified a bit and removed uneccesary c_rehash.