Changed how we merge and sort tokens in TokenReplacer to achieve the expected behavior.