Improve command line interface code