refactor CLI