doc and refactoring