Amended version of perfect functional shuffle for p25.

Thanks to @jafingerhut for pointing me in the right direction.