merging in @shanqiu's latest updates