Improve snake heuristic and use it instead of gradient