cleaned up some of the web server main code.