trimming and segmenting pathfinding.