Minor refactor, added CLI test cases, updating documentation