Better handling of response codes