diff --git a/srcx/ImageJ/Demo_Pixel_Replication_Threads.java b/srcx/ImageJ/Demo_Pixel_Replication_Threads.java
index f3b5349f0818d5265ea646b808daff913f4653ef..0c86c00db621ed7f06d8183b76a7c43124a88f7b 100755
--- a/srcx/ImageJ/Demo_Pixel_Replication_Threads.java
+++ b/srcx/ImageJ/Demo_Pixel_Replication_Threads.java
@@ -9,6 +9,7 @@ import java.nio.FloatBuffer;
 import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.Random;
+import java.time.LocalTime;
 
 import static org.bytedeco.javacpp.opencv_core.*;
 import static org.bytedeco.javacpp.opencv_imgproc.*;
@@ -65,16 +66,17 @@ public class Demo_Pixel_Replication_Threads implements PlugInFilter {
             Mat initMeans = randomInitMeans(k);
             IJ.log(String.format("thread %d em randomInitMeans();", idx));
 
-            synchronized(lock1) {
+            // synchronized(lock1) {
             // try {
-                IJ.log(String.format("before, thread %d, trained ", idx) + em.isTrained());
-                em.trainE(emMat, initMeans, new Mat(), new Mat(), logLikelihoods, labels, new Mat());
-                IJ.log(String.format("after, thread %d, trained ", idx) + em.isTrained());
+                // IJ.log(String.format("before, thread %d, trained ", idx) + em.isTrained());
+                // em.trainE(emMat, initMeans, new Mat(), new Mat(), logLikelihoods, labels, new Mat());
+                train(em, emMat, initMeans, new Mat(), new Mat(), logLikelihoods, labels, new Mat());
+                // IJ.log(String.format("after, thread %d, trained ", idx) + em.isTrained());
             // } catch (Exception e) {
             //     IJ.log("Caught exception in em.trainE: " + e.getMessage());
             // }
-            }
-            IJ.log(String.format("thread %d em em.trainE();", idx));
+            // }
+            // IJ.log(String.format("thread %d em em.trainE();", idx));
 
             synchronized(lock2) {
                 ems[idx] = em;
@@ -82,6 +84,14 @@ public class Demo_Pixel_Replication_Threads implements PlugInFilter {
             }
             IJ.log(String.format("replicate %d score = %f", idx, em_scores[idx]));
         }
+
+        public synchronized void train(EM em, Mat emMat, Mat initMeans, Mat tmp1, Mat tmp2, Mat logLikelihoods, Mat labels, Mat tmp3) {
+            IJ.log(String.format("%s before, thread %d, trained ", LocalTime.now(), idx) + em.isTrained());
+            em.trainE(emMat, initMeans, new Mat(), new Mat(), logLikelihoods, labels, new Mat());
+            IJ.log(String.format("%s after, thread %d, trained ", LocalTime.now(), idx) + em.isTrained());
+            IJ.log(String.format("%s thread %d em em.trainE();", LocalTime.now(), idx));
+        }
+
     }
 
     public Demo_Pixel_Replication_Threads() {