Added random direction code