revised implementation of parallel distinct