refactoring and script catchup