Hashing and loop changes

Removed some for comprehensions in favor of while loops and changed otherHashCode to a Long.