add doc
refactor codes