Code reorganization, added document's buildTree API.