tidied client.js