refactoring and add document