extract getOutputFile method