redid astar in a way I understand more. bonus: traded infinite loop for nil dereference