added sleep and loops