Now using io.BytesIO instead of StringIO