Merged netsd code into threaded_prototype