Ns improve distinct

@tleach