Refactoring changes of docfest import

Here are the refactoring changes.