proper indentation, no other changes
rename var since not a getopt var any longer: opt_x -> cmd
handle errors more gracefully
handle errors more gracefully; formatting knits
no longer getopt, so rename var: opt_x -> cmd
update to slightly closer reality