Moved all of the path simulation code to a separate function.
Set up the use of separate threads for each simulation.
Set up the simulation to run every trial in a separate thread.
Put the data file output into a separate routine and added a mutex for the output.