some improvements after a testing with sockets