Minor refactoring and fixes.
Split AggregateOperation into three: AggregateOutputToCollectionOperation, AggregateReadOperation and AggregateWriteOperation.