used getopt for parsing