refactored command line parameter handling