add group and aggregate functions