Stop loops from running after target is found