Separate distinct, add unit tests