update doc
refactor test, reduce code