Network pathfinding code restructuring