adding getopt for cmdline parameters; need to add flags for key reading etc