Updated the shuffle code to a better algorithm