Change CommandLine to have a simpler interface; minor refactorings