refactor shuffle method