some further cleanup in chat.js