added scramble function