improve direction and astar