added support for aggregation functions