Re-written server with sockets