Randomization fixed - working version