updating code and doc