v1.8: -Added randomHeuristic type, -Combined if statements in line 158