improve doc and code