Updated chat.js