Break up the text substitution code into sensibly-sized units