Minor scripts refactorings
Minor scripts refactorings