Reverts yvarov's astar rewrite from 16/5

Maintains the other associated fixes/changes. 

I'm unsure about "BestF" in the master_controller (whatever it is) but after this change it seems to work fine in testing regardless.