Improve logic of text before and after utils