First implementation of shuffling