market now uses rewrite_string() function

So that this only needs to be maintained in one place