Add distinct with index + tests