So you need to know when to stop looping. Any ideas how you might do that?