Implementation of uniq