improve logic
improve doc