Shouldn't the total counter be increased by one to account for the main match? `total += lm.size() + 1; // +1 for the main match`