Add support for aggregation, fix bug where an invalid filter was being called as a function