Added aggregate function support