Handle backslashes, escaped backslashes, escaped newline chars; fixed string length counting bug