Squashed commit of the following:
    improve detect-duplicates to detect dups in internal dependencies