added tests and fixed issue with escaped quoted string at end of string