Improve periodMode in language model