first version of the A* algorithm, not too pretty and not fully working yet...