Optimization of chained sequences with closures
FROGSS++; this is closer to the original version;
still passes tests from RT #123329