Copy the old code from xen-semi to the array snippet that used it.