New command line option parsing, signals and some bugfixes.