Refactoring and reorganization