Document and optimize the client js a bit