updated methods to pass xhr back to caller