Implement new distance heuristic