reduce_to_unique function

Reduce to unique cases