refactoring of tesRun.js