simplified getopt code