Refactored command line dispatcher.