Implemented simulation run with channels; needs testing but appears to work. Moved io methods to separate file.