Many changes to the client/server stuff. It is working but still a lot
of cleaning up and debugging to do. Main thing left is properly terminating
the threads.