script refactoring continues