added pregenerate_matches