Added getopt() functionality