incorporating modifications to mempool done by Gengbin