using sleep and loops