enhanced version to deal with multiple chat-rooms