A* algorithm almost ready (minor detail to be added).