Refactoring and enabling cleanup
Patching tests