tested data send/recv
cleaned code