Added support for complex aggregation functions and udf support