Refactoring of the memberhsip aggregation task.