reworking response processing logic