modify algorithm to reduce the number of shuffle bytes