Added fetchMessageCollection function and addToChatWindow function