Added *num-trials*, *max-trials* and checking of whether the test code is ever run...