almost finished, still the socket communication remaining