Added API data aggregation logic