avoid looping more than we have to