GetEmitOutput function and testfiles

define a function instead of using a function expression. this way you have a better chance of optimization