Refactoring script