Improved client/server connection. Should fix #10 and #11