Why is this added here rather than being a back-end utility? We can probably extract it into the util under the text() space.