Implemented the shuffling