getopt method