updated to use the new rbuf api + optimizations

saved one copy for each chunk of data read from the network
and removed some dead code as well