I understand the need of the sleep in here, because of the reasons explained in the comment, but I can't help to cringe when seeing it. 

Is there any other way so we can avoid this?