refactored scoreDuplicates so that we don't have huge intermediate objec...

...ts, related to #222 and #187