Bunch of clean up in sockets.js.