refactoring in secondary scripts