Update the wait method for response