Refactor some command line interface