refactoring staging scripts