Cleaned and commented aggregation
Code refactoring, added some comments, enhanced names