less raw writing to sockets, more wrapping