Added command line options and input validations.