working version of the output as well