add thread sleep in for loop