Change hash function.
Various minor improvements on task 3.