Patch by Felipe Kellermann, use the common escape handling function and remove some...