Cleaning up handle_response a bit. (Imported from 1.4)