Better aggregation support

Added support and tests for aggregation operations.
Looks like some whitespace formatting consistency needs to be applied on this method.