Restructured and added getopt

Added help dialog.