Added a timeout when a flawed agent is present, the capacity to write
the results to a crv file, and some minor tweaks