aupdating documentation, refactoring