updated chat.js