diff --git a/src/main/java/org/ids_mannheim/Progressbar.java b/src/main/java/org/ids_mannheim/Progressbar.java
index 9bddc6a..8b57cb9 100644
--- a/src/main/java/org/ids_mannheim/Progressbar.java
+++ b/src/main/java/org/ids_mannheim/Progressbar.java
@@ -6,30 +6,22 @@
 import java.time.format.DateTimeFormatter;
 
 public class Progressbar {
-    private final long max;
-    private long current;
-    private final long start;
-    private long lastUpdate;
-    private static final int width=40;
-//    private static final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+    private static final int width = 40;
+    //    private static final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
     private static final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("ccc dd. LLL HH:mm:ss");
+    private final long max;
+    private final long start;
+    private long current;
+    private long lastUpdate;
 
     public Progressbar(long max, String name) {
         this.start = System.currentTimeMillis();
-      this.max = max;
+        this.max = max;
         System.err.println(name + ":");
         this.printBar(false);
     }
 
-    public void setVal(long i) {
-        this.current = i;
-        if ((System.currentTimeMillis() - this.lastUpdate) > 100) {
-            this.lastUpdate = System.currentTimeMillis();
-            this.printBar(false);
-        }
-    }
-
-    public void update(long i) {
+    public synchronized void update(long i) {
         this.current += i;
         if ((System.currentTimeMillis() - this.lastUpdate) > 100) {
             this.lastUpdate = System.currentTimeMillis();
@@ -57,40 +49,30 @@
     private void printBar(boolean finished) {
         double numbar = Math.floor(width * (double) current / (double) max);
         StringBuilder strbar = new StringBuilder();
-        String percent = String.format("%3d%%", (int)(100 * (double) current / (double) max));
         int i;
-        for (i = 0; i < numbar-1; i++) {
+        for (i = 0; i < numbar - 1; i++) {
             strbar.append("=");
         }
-        for (i = (int) numbar-1; i < numbar; i++) {
-          if (i < width-1) {
-            strbar.append(">");
-          } else {
-            strbar.append("=");
-          }
+        for (i = (int) numbar - 1; i < numbar; i++) {
+            if (i < width - 1) {
+                strbar.append(">");
+            } else {
+                strbar.append("=");
+            }
         }
         for (i = (int) numbar; i < width; i++) {
             strbar.append(" ");
         }
         long elapsed = (System.currentTimeMillis() - this.start);
-        String strend = hmsFromMillis(elapsed);
-
-        String strETA;
-        if (elapsed < 2000) {
-            strETA = "--:--:--";
-        } else {
-            long timeETA = elapsed * (long) ((double) max / (double) current);
-            strETA = hmsFromMillis(timeETA) + " -> " + shortDateTimeFromMillis(start + elapsed + timeETA);
-        }
-
-        String speed = String.format("@%.1fMB/s", 1000.0 * current / (1024*1024) / elapsed);
-        if (finished) {
-            strend = "Finished: " + speed + " " + strend + " = " + shortDateTimeFromMillis(System.currentTimeMillis());
-        } else {
-//          strend = "Elapsed: " + strend + " ETA: " + strETA + "\u001B[0K";
-            strend = speed + " ETA: " + strETA + "\u001B[0K";
-        }
-        System.err.print("\r" + percent+ " [" + strbar + "] " + strend + "\u001B[0K");
+        long ttg = (long) (((double) elapsed / (double) current) * (max - current));
+        System.err.print(String.format("\r%3d%% [%s] %.1fMB/s ELA: %s TTG: %s ETA: %s\u001B[0K",
+                (int) (100 * (double) current / (double) max),
+                strbar,
+                1000.0 * current / (1024 * 1024) / elapsed,
+                hmsFromMillis(elapsed),
+                hmsFromMillis(ttg),
+                shortDateTimeFromMillis(start + elapsed + ttg)
+                ));
         if (finished) {
             System.err.print("\n");
         }
