refactored astar and moved it to cofee