some improvement to cli.js