redesign to separate input, output, and engine.