Simplify implementation of critical sections.
Hack it with for loops, instead of lambda functions.
MotionPlanner: compensate for FP errors in split count calculation using
multiplication, not addition. This will avoid splitting small input
segments to one more segment even though the length is not even close to the point where that would be necessary.