Refactor quite a lot, and thus test failure of some commands and of server startup.