Fix command line parsing. Remove some dead code.