This program should be refactored into RunManager jobs so this can be used as part of a simulation workflow.  A standalone program is still fine but I would see this more as a Ruby script.