now handles responses from server