made AStar more flexible