starting refactoring
added cli tests