testing, split cli and logic, refactor