add Weiliang's implementation