refactor the CLI