Avoiding sleep loop