Better abstraction of the text range generation