Fixed client-server communication. Client also now properly reconnects if disconnected.