Improve shuffle algorithm