Private handle_response method