client.js cleanup

mostly just drying stuff up, no api changes