working on randomized, works fine