public Kernel getProperKernel() {
    apiMatchedOnce = false;
    baseMatchedOnce = false;

    if (kernelSet.isEmpty()) {
      return null;
    }

    Iterator<Kernel> iterator = kernelSet.iterator();

    while (iterator.hasNext()) {
      Kernel k = iterator.next();
      try {
        boolean a =
            k.getBASE()
                .contains(preferences.getString(Keys.KEY_SETTINGS_ROMBASE, "").toUpperCase());
        boolean b =
            k.getAPI().contains(preferences.getString(Keys.KEY_SETTINGS_ROMAPI, "").toUpperCase());
        if (a) baseMatchedOnce = true;
        if (b) apiMatchedOnce = true;
        if (a & b) {
          if (!k.isTestBuild() || preferences.getBoolean(Keys.KEY_SETTINGS_LOOKFORBETA, false)) {
            return k;
          }
        }
      } catch (NullPointerException ignored) {
      }
    }

    return null;
  }
 public void sniffKernels(String data) {
   String[] parameters = data.split("\\+kernel");
   kernelSet.clear();
   for (String params : parameters) {
     if (params.equals(parameters[0])) continue;
     add(new Kernel(params));
   }
 }
 public boolean add(Kernel k) {
   return kernelSet.add(k);
 }