cleaned code, and added sockets again