Finish command line improvement and add tests. Closes #16