Package reorganization, formatting and refactoring