almost done with random ordering