Moved the label aggregation to its own file