Made the code even simpler and shorter.

Added method setChatMode.