String ending bug and tidyup.

Fixed a bug with already escaped slashes in front of a ending slash in a string.
Tidied up a little bit.