Abstract cli to testable file. Ref #68
Refactor and test CLI. Closes #68