Fixes related to commandline options

These mostly make the commandline a bit more robust. This also includes some refactoring to put the actual parsing code for the --board option in the right place.

I'll send a mail to the list in a minute with some additional throughts related to the commandline interface.