implemented setTimeout recursive loop