Now quits if input is invalid.
Added ability to specify arguments from the command line.