Changed api format. Added more aggregation functionality.