implemented getopt parsing of command-line switches