Moving a necessary sleep statement