refactored the Aggregator and TempMain class