changed array shuffling to fisher-yates