This seems a bit fiddly.  Isn't the nicer solution just to pass the "output" function into project?