diff --git a/test_ETROC.py b/test_ETROC.py
index 2a6e611e504fea4f6eda91837f6e17c0591c2849..58355b57a8f0ad8c6c6020c9fb3fb6dd367a5832 100644
--- a/test_ETROC.py
+++ b/test_ETROC.py
@@ -117,13 +117,12 @@ def vth_scan_internal(ETROC2, row=0, col=0, dac_min=0, dac_max=500, dac_step=1):
     return [dac_axis, run_results]
 
 
-if __name__ == '__main__':
-
-    # initiate
-    ETROC2 = software_ETROC2()  # currently using Software ETROC2 (fake)
-    print("ETROC2 emulator instantiated, base configuration successful")
-    DF = DataFrame('ETROC2')
+# initiate
+ETROC2 = software_ETROC2()  # currently using Software ETROC2 (fake)
+print("ETROC2 emulator instantiated, base configuration successful")
+DF = DataFrame('ETROC2')
 
+if __name__ == '__main__':
     # argsparser
     import argparse
     argParser = argparse.ArgumentParser(description = "Argument parser")
diff --git a/test_tamalero.py b/test_tamalero.py
index 5ed63f70b38b2674190a8690ced6518cbd1e5267..636312e382389074126cfd509843330b5ac7fe01 100644
--- a/test_tamalero.py
+++ b/test_tamalero.py
@@ -7,14 +7,18 @@ from tamalero.ETROC import ETROC
 from tamalero.Module import Module
 
 from tamalero.SCA import SCA_CONTROL
+from test_ETROC import vth_scan, fromPixNum
 
 import time
 import random
 import sys
 import os
 import uhal
+import json
+import datetime
+import numpy as np
 from emoji import emojize
-from flask import Flask
+from flask import Flask, request
 
 def create_app(rb, modules=[]):
     # FIXME this should live somewhere else in the future
@@ -27,7 +31,9 @@ def create_app(rb, modules=[]):
 
     @app.route('/rb_temp')
     def temperatures():
-        return rb.read_temp()
+        temp = rb.read_temp()
+        temp['time'] = datetime.datetime.now().isoformat()
+        return temp
 
     @app.route('/module_links')
     def get_link_status():
@@ -59,22 +65,46 @@ def create_app(rb, modules=[]):
             for j, etroc in enumerate(module.ETROCs):  # 4 ETROCs expected per module
                 if etroc.is_connected():
                     stat = etroc.pixel_sanity_check(return_matrix=True)
-                    etroc_status[i][j] = {}
-                    for k in range(16):
-                        etroc_status[i][j][k] = {}
-                        for l in range(16):
-                            etroc_status[i][j][k][l] = int(stat[k][l])
-            #for j in range(4):
-            #    etroc_status[i*4+j] = {}
-            #    # NOTE here we should get the actual status
-            #    # below is just a placeholder
-            #    for k in range(16):
-            #        etroc_status[i*4+j][k] = {}
-            #        for l in range(16):
-            #            etroc_status[i*4+j][k][l] = 1
-
+                    etroc_status[i][j] = stat.astype(int).tolist()
         return etroc_status
 
+    @app.route('/threshold_scan', methods=['POST'])
+    def run_threshold_scan():
+        payload = json.loads(request.data)
+        print(f"Threshold Scan on module {payload['module']}, etroc {payload['etroc']}")
+
+        module = modules[int(payload['module'])]
+        etroc = module.ETROCs[int(payload['etroc'])]
+        fifo = FIFO(rb=rb_0)
+
+        vth_scan_data = vth_scan(
+            etroc,
+            vth_min = 220,
+            vth_max = 290,
+            decimal = True,
+            fifo = fifo,
+            absolute = True,
+        )
+
+        vth_axis    = np.array(vth_scan_data[0])
+        hit_rate    = np.array(vth_scan_data[1])
+        N_pix       = len(hit_rate) # total # of pixels
+        N_pix_w     = int(round(np.sqrt(N_pix))) # N_pix in NxN layout
+        max_indices = np.argmax(hit_rate, axis=1)
+        maximums    = vth_axis[max_indices]
+        max_matrix  = np.empty([N_pix_w, N_pix_w])
+
+        for pix in range(N_pix):
+            r, c = fromPixNum(pix, N_pix_w)
+            max_matrix[r][c] = maximums[pix]
+
+        threshold_status  = {}
+        threshold_status['vth_axis'] = vth_axis.tolist()
+        threshold_status['hit_rate'] = hit_rate.tolist()
+        threshold_status['max_matrix'] = max_matrix.tolist()
+
+        return threshold_status
+
     return app
 
 if __name__ == '__main__':
@@ -251,7 +281,7 @@ if __name__ == '__main__':
 
     if args.server:
         app = create_app(rb_0, modules=modules)
-        app.run(port=args.port)
+        app.run(port=args.port, threaded=False)
 
     #-------------------------------------------------------------------------------
     # Read ADCs