added sleep to while