remove convoluted and no longer useful code, wrting in a StringIO is now straightforward