better path finding algorithm