Refactor nested_merge

Extract the collection of 'collect' fields into separate methods to
make it a little clearer what's happening.

@robyoung
@pbadenski