rewrite of command line parsing in mtd