refactor consumer