Switched argument reading to getopt and added -h option