Litte refactor for cli