Code refactor.
Update doc.