Updating documentation and refactoring