clean up straggling text sections

- After splitting the text content into subsections, there were
occasional problems where the content of the last text section used for
measurement would be retained outside the tspans, offsetting the
wrapping box.
- add code comments