cleaning up the output code to work properly for the Future