Changed the hash function to djb2 that has better distribution.
Fixed a bug that would have caused a runtime panic when the hash was greater than the length of the array, or the array was empty.