Refactoring; cleanup.