Escape special chars

This code additionally escapes special characters (already has changes from issue #20