refactoring and doc