modifications for memory optimized XPAY