Some improvements to client.js