Added loops

added the delay loop and some hints from lecture and prompt