Improved the example code by making the web server run on its own thread.