Need help creating a loop, then exiting a loop.