Doc updates and refactoring