Added command line option for output file name.
Also fixed script to run simulation.