Expanded scramble function