Factor out the level offsetting into a final pass.  Let the first
pass of the "chain" operation just stitch things together and count levels.