Tested with the sleep function called