change to my style of pathfinding code