added client reading, writing