refactored aggregations to make them more manageable