extract functions returns filename of output file