separated functions in shuffle.py