More or less finished with #2, except for the webserver stuff. Will merge this branch now.