rewrote rewrite_strings function to make websafe

some conversions weren't handing url-safe strings