diff --git a/.gitignore b/.gitignore
index 713dd31533fcbea220835943ad515535bdc4679b..a1f94ae8e87abc471803224ef731870b73bdf8cd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,4 +3,5 @@ out/*
 CHANGELOG.md
 profiling.log
 data/data
-data.zip
\ No newline at end of file
+data.zip
+__pycache__/**
\ No newline at end of file
diff --git a/main.py b/main.py
index 684c1c6c7b9599b5127a6aef361772b0a7a19efd..4a48178ca77cf17e25a46ea9bc0017ef1744d256 100644
--- a/main.py
+++ b/main.py
@@ -152,8 +152,6 @@ def main(config: Any) -> None:
         last_write = time.time()
         data = np.zeros((8,))
         n = 0
-        recv1, recv2 = None, None
-        off1, off2 = None, None
         while datetime.datetime.now() + datetime.timedelta(seconds=delta_time) < end_time:
 
             try:
@@ -162,30 +160,24 @@ def main(config: Any) -> None:
 
                 con1.write(1)
                 # offsets for writing data in correct column
-                off1 = 0 if int(convert(con1.readline())) == 1.0 else 4
+                off = 0 if int(convert(con1.readline())) == 1.0 else 4
 
                 # read data
                 for i in range(4):
-                    recv1 = con1.readline()
-                    new_data[i + off1] += float(convert(recv1))
-                    recv1 = None
-                off1 = None
+                    new_data[i + off] += float(convert(con1.readline()))
 
                 con2.write(1)
                 # offsets for writing data in correct column
-                off2 = 0 if int(convert(con2.readline())) == 1.0 else 4
+                off = 0 if int(convert(con2.readline())) == 1.0 else 4
 
                 for i in range(4):
-                    recv2 = con2.readline()
-                    new_data[i + off2] += float(convert(recv2))
-                    recv2 = None
-                off2 = None
+                    new_data[i + off] += float(convert(con2.readline()))
 
                 n += 1
                 data = new_data
             except (TypeError, ValueError):
-                # may occur if no data was read over serial, but why???
-                logger.info(f"Didn't receive data from arduino, off1: {off1}, off2: {off2}, recv1: {recv1}, recv2: {recv2}", exc_info=True)
+                # may occur if no data was read over serial
+                logger.info("Didnt receive data from arduino", exc_info=True)
 
             if time.time() - last_write > delta_time:
                 # write data
@@ -196,12 +188,9 @@ def main(config: Any) -> None:
                 last_write = time.time()
 
     fh[0].doRollover() # rollover the current data log file
-    
-    
-    Path(f"{Path(__file__).parent}/data/data").unlink(missing_ok=True) # delete old data file
 
     logger.warning("Finished")
 
 
 if __name__ == "__main__":
-    main(yaml.safe_load(open(f"{Path(__file__).parent}/config.yml")))
+    main(yaml.safe_load(open(f"{Path(__file__).parent}/config.yml")))
\ No newline at end of file
diff --git a/scripts/push.bash b/scripts/push.bash
index 8d8dda2586b2b3a255e663a58375f99a29b993a2..4d4fb212d60b874946c5c6b9200851f795ed77eb 100755
--- a/scripts/push.bash
+++ b/scripts/push.bash
@@ -6,22 +6,28 @@ while pidof  -x "python3 main.py">/dev/null; do
     echo "python3 main.py is still running, checking in 60 seconds."
     sleep 60
 done
-sleep 10
-
-du -hc --max-depth=1 .
-
-scripts/./write.bash
 
 sleep 10
 
-python3 measure.py
+scripts/./write.bash
 
 sleep 10
 
 echo -e "Starting python script:\n"
-python3 main.py
+if python3 main.py then
+    rm data/data
+fi
 echo -e "\nPython script ended"
 
 git pull
+
+last_commit_name = $(git log -1 --pretty=%B | cat)
+
+if [[ $string == *"New data"* ]]; then
+    # check if the last commit was "New data"
+    # if yes overwrite the commit
+    git reset --soft HEAD~1
+fi
+
 git add .
 git commit -m "New data" && git push --force
\ No newline at end of file