added getopt for better option parsing