Rewrote socket wrapper