updated response handling