DRY up client.js