Modified A* Algorithm logic and a few other small changes