Adding A* algorithm