please avoid using Sleep; prefer keywords like Wait until…