Improve use of api responses.

Also disallow assignment in conditions (jshint.)