updating search code and distance heuristic