refactoring scripts