Completed problem 2 code, this will dump the results in a test file which we can analyze to set the appropriate threshold