Add path duplication removal code.