redid server as threaded, added some examples