minor changes, tried a new implementation of pathsToGoal but it didn't
work out for some reason