Adding string replacement to clean up the javascript-safe string