Added error handling to command line options