Used preg_replace and regular expressions to narrow down dollar sign replacement to fix script problems.