rewrite for single XPUB rail pattern