move processing of command line parameters to a seperate function