Added dupe detection (fixed #2)