Cli refactor