Script2 refactoring