Refactoring, documentation update