update based on Hongkai's suggestion