upgrade to handle multi-input/output files --kazu