optimized astar search