Refactor CLI