Fixed a bug in collection attribute reduce where the collection was not being attached when first setup.
Refactored some collection attribute reduce code.