Adding pathfinding code