Improved escaping/unescaping.