Substantial reorganization and refactoring