Performance improvements, change hash function