Cleaning up code in aggregator