added duplicates functionality to deal with issue #290