Sort quotes and handle escaping nicer