Refactoring cleanup script