small amount of code cleanup. Changed MAX_DATA from 2^17 to 2^16 because I got disconnected a couple of times.