Add commander.

Note that this commit also includes some cleanup, which were difficult
to avoid in the same commit.
Merge branch 'commander' into v0.6-wip