added custom aggregation function support