I think this was all because I thought I was getting extra emails for some updates.  I may have had another underlying problem that I was fixing.  The essence of this update is removing duplicates from the output id-list.