Refactor response processing.