cleanup
diff --git a/app/src/main/java/com/libremobileos/facedetect/MainActivity.java b/app/src/main/java/com/libremobileos/facedetect/MainActivity.java
index b68a247..0ddda96 100644
--- a/app/src/main/java/com/libremobileos/facedetect/MainActivity.java
+++ b/app/src/main/java/com/libremobileos/facedetect/MainActivity.java
@@ -89,9 +89,9 @@
   private static final String TF_FD_API_MODEL_FILE = "detect-class1.tflite";
   private static final String TF_FD_API_LABELS_FILE = "file:///android_asset/face_labels_list.txt";
 
-  private static final DetectorMode MODE = DetectorMode.TF_OD_API;
   // Minimum detection confidence to track a detection.
   private static final float MINIMUM_CONFIDENCE_TF_OD_API = 0.5f;
+  private static final float MAXIMUM_DISTANCE_TF_FD_API = 0.8f;
   private static final boolean MAINTAIN_ASPECT = false;
 
   private static final Size DESIRED_PREVIEW_SIZE = new Size(640, 480);
@@ -314,19 +314,12 @@
             paint.setStyle(Style.STROKE);
             paint.setStrokeWidth(2.0f);
 
-            float minimumConfidence = MINIMUM_CONFIDENCE_TF_OD_API;
-            switch (MODE) {
-              case TF_OD_API:
-                minimumConfidence = MINIMUM_CONFIDENCE_TF_OD_API;
-                break;
-            }
-
             final List<SimilarityClassifier.Recognition> mappedRecognitions =
                     new LinkedList<SimilarityClassifier.Recognition>();
 
             for (final SimilarityClassifier.Recognition result : results) {
               final RectF location = result.getLocation();
-              if (location != null && result.getDistance() >= minimumConfidence) {
+              if (location != null && result.getDistance() >= MINIMUM_CONFIDENCE_TF_OD_API) {
                 //LOGGER.i("wjy debug fuck**" +result.getTitle());    //wjy
 
                 canvas.drawRect(location, paint);
@@ -358,20 +351,20 @@
     return DESIRED_PREVIEW_SIZE;
   }
 
-  // Which detection model to use: by default uses Tensorflow Object Detection API frozen
-  // checkpoints.
-  private enum DetectorMode {
-    TF_OD_API;
-  }
-
   @Override
   protected void setUseNNAPI(final boolean isChecked) {
-    runInBackground(() -> detector.setUseNNAPI(isChecked));
+    runInBackground(() -> {
+      detector.setUseNNAPI(isChecked);
+      faceDetector.setUseNNAPI(isChecked);
+    });
   }
 
   @Override
   protected void setNumThreads(final int numThreads) {
-    runInBackground(() -> detector.setNumThreads(numThreads));
+    runInBackground(() -> {
+      detector.setNumThreads(numThreads);
+      faceDetector.setNumThreads(numThreads);
+    });
   }
 
 
@@ -481,11 +474,6 @@
     paint.setStrokeWidth(2.0f);
 
     float minimumConfidence = MINIMUM_CONFIDENCE_TF_OD_API;
-    switch (MODE) {
-      case TF_OD_API:
-        minimumConfidence = MINIMUM_CONFIDENCE_TF_OD_API;
-        break;
-    }
 
     final List<SimilarityClassifier.Recognition> mappedRecognitions =
             new LinkedList<SimilarityClassifier.Recognition>();
@@ -521,8 +509,7 @@
 
       final RectF boundingBox = new RectF(face.getLocation());
 
-      //final boolean goodConfidence = result.getConfidence() >= minimumConfidence;
-      final boolean goodConfidence = true; //face.get;
+      final boolean goodConfidence = face.getDistance() >= MINIMUM_CONFIDENCE_TF_OD_API;
       if (boundingBox != null && goodConfidence) {
 
         // maps crop coordinates to original
@@ -573,7 +560,7 @@
 //          }
 
           float dist = result.getDistance();
-          if (dist < 1.0f) {
+          if (dist < MAXIMUM_DISTANCE_TF_FD_API) {
 
             distance = dist;
             label = result.getTitle();