Extracted much of the logic for running input sequences for reuse in output.