Make the main startup function a class so it can be customised.

This just makes it possible to change the layout and default plugins
without having to copy all the startup and option parsing code.