clean up aggregation code

easier to use. more efficient (compiled & cached)
Merge branch 'tf/aggr2'