refactoring all scripts