Updated sendRequest method