Deduplicated code, eliminated manual array<->collection transfers.