distance heuristics working