Refactor cleanChatData