Smarter escape-string

Implements a fix for #114; use single or double quotes for string literals depending on the context