Final cleanup of aggregation framework

I added something like this in my compiler refactoring pull request