More genericization & efficiency improvement.

Switching to a regular for loop instead of map / reduce in intersect()
produces huge savings.