Aggregation supports multiple variables, refactoring