convert to a more complete optionlist

Right now the option list could be handled better with getopt