apply refactor script