Clean up the JavaScript powering the demo ChatApp a bit.