Implemented getopt for option parsing.