a bit of everything: more structure, some command line handling