optimize astar alg, added verbose comments