move aggregates to separate module, change interface to allow aggregation on two variables