clean up and speed up unit test for threshold tuning