generic astar working