corrected the shuffling logic and added the permuter