refactor chain response handling