refactor of cli