"Unfactored" the flag() suroutine back to the loop