CLI refactoring

References #20.