refactoring using new command line script api