XHR wrapper code modified