Move these declarations to the top of the function body and rename `textSplit` to something less awful and more plural, eg. `chunks` or `fragments`