fixed issues with command-line parsing

++ change structure a bit