added getopt support