Refactored command line functions.