Move escape handling to DLL