tiny performance improvement: break out of the inner loop if we found a match