Added handling of chat messages.