Added code to allow for running the simulation with a variety of trials.