finished the main of astar